﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using eschoolBO;

namespace ESCHOOL.parents
{
    public partial class WebForm7 : System.Web.UI.Page
    {
        parent par = new parent();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Label1.Visible = false;
                Panel1.Visible = true;
            }
        }

        protected void btnchg_Click(object sender, EventArgs e)
        {
            DataTable dt = par.GetRecords(Convert.ToInt64(Session["userid"]), "", "", "", "", "", "", "", -99, "", -99, "", tboldpass.Text , -99,"","", false, " and ");
            if (dt.Rows.Count > 0)
            {
                par.parent_id = Convert.ToInt64(dt.Rows[0]["parent_id"].ToString());
                par.father_name = dt.Rows[0]["father_name"].ToString();
                par.mother_name = dt.Rows[0]["mother_name"].ToString();
                par.father_qualification = dt.Rows[0]["father_qualification"].ToString();
                par.mother_qualification = dt.Rows[0]["mother_qualification"].ToString();
                par.father_occupation = dt.Rows[0]["father_occupation"].ToString();
                par.mother_occupation = dt.Rows[0]["mother_occupation"].ToString();
                par.permanent_address = dt.Rows[0]["permanent_address"].ToString();
                par.phone_no = Convert.ToInt64(dt.Rows[0]["phone_no"].ToString());
                par.parent_emailid = dt.Rows[0]["parent_emailid"].ToString();
                par.user_type_id = Convert.ToInt64(dt.Rows[0]["user_type_id"].ToString());
                par.username = dt.Rows[0]["username"].ToString();
                par.password = tbnewpass.Text;
                par.student_id = Convert.ToInt64(dt.Rows[0]["student_id"].ToString());
                par.isdeleted = false;
                par.SaveRecords();
                Label1.Visible = true;
                Label1.Text = "Your password has been changed";
                Panel1.Visible = false;
            }
            else
            {
                Label1.Visible = true;
                Label1.Text = "Failed! try again.";
            }
        }
    }
}
